Append items from listΒΆ

A.fromlist(L)

Append items from a specified list.

from array import *

L = [1, 2, 6, -8]
AI = array('i', [])

print("Items in the list: " + str(L))
print("Append items from the list: ")

AI.fromlist(L)

print("Items in the array: " + str(AI))
# array('i', [1, 2, 6, -8])

See also: https://www.w3resource.com/python-exercises/array/python-array-exercise-9.php